/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package biermanager.componentes;

import java.beans.*;
import java.io.Serializable;
import java.awt.Color;
import java.awt.LinearGradientPaint;
import java.awt.MultipleGradientPaint.ColorSpaceType;
import java.awt.MultipleGradientPaint.CycleMethod;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.RoundRectangle2D;
import org.jdesktop.swingx.JXPanel;
import org.jdesktop.swingx.painter.AbstractLayoutPainter.HorizontalAlignment;
import org.jdesktop.swingx.painter.CompoundPainter;
import org.jdesktop.swingx.painter.MattePainter;
import org.jdesktop.swingx.painter.Painter;
import org.jdesktop.swingx.painter.ShapePainter;
/**
 *
 * @author tiagoloureiro
 */
public class PainelTitulo extends JXPanel implements Serializable {

    public Painter painelArredondado() {
        RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(0, 0, (float) this.getPreferredSize().getWidth(), (float) this.getPreferredSize().getHeight(), 1,1);
        ShapePainter sp = new ShapePainter(roundedRectangle);
        sp.setAntialiasing(true);
        sp.setHorizontalAlignment(HorizontalAlignment.CENTER);        
        Color cor1 = new Color(240, 0, 0,100);
        Color cor2 = new Color(120, 0, 0,100);
        Point2D start = new Point2D.Float(0, 0);
        Point2D end = new Point2D.Float(0, (float) ((this.getPreferredSize().getHeight() - 1) / 2));
        float[] dist = {0.0f, 1.0f};
        Color[] colors = {cor1, cor2};
        LinearGradientPaint p = new LinearGradientPaint(start, end, dist, colors, CycleMethod.NO_CYCLE,ColorSpaceType.SRGB,AffineTransform.getQuadrantRotateInstance(0));
        sp.setFillPaint(p);
        MattePainter mp = new MattePainter(p);
        MattePainter mp2 = new MattePainter(new Color(0, 0, 0));
        return (new CompoundPainter(sp));
    }


    public static final String PROP_SAMPLE_PROPERTY = "sampleProperty";

    private String sampleProperty;

    private PropertyChangeSupport propertySupport;

    public PainelTitulo() {
        propertySupport = new PropertyChangeSupport(this);
    }

    public String getSampleProperty() {
        return sampleProperty;
    }

    public void setSampleProperty(String value) {
        String oldValue = sampleProperty;
        sampleProperty = value;
        propertySupport.firePropertyChange(PROP_SAMPLE_PROPERTY, oldValue, sampleProperty);
    }


    public void addPropertyChangeListener(PropertyChangeListener listener) {
        propertySupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        propertySupport.removePropertyChangeListener(listener);
    }

}
